<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Request;
use yii\web\Response;
use yii\filters\VerbFilter;
use app\models\guide_v2;


class HomeController extends Controller
{

    /**
     * Displays homepage.
     *
     * @return string
     */
    public function actionIndex()
    {

        $guideList = guide_v2::find()->asArray()->all();

        return $this->render('index');

    }

    public function actionGuides(){

        // 收到的请求 可以取出发送请求的参数
        $request = \Yii::$app->request;

        if ($request->isGet){

            $guideList = guide_v2::find()->limit(6)->asArray()->all();

            $reponse = array('status'=>'sucess','data'=>$guideList);

            $data = json_encode( $reponse,JSON_UNESCAPED_UNICODE);


            return $data;
        }


    }



}
